import Vue from 'vue'
import Router from 'vue-router'
import Login from '../views/login/login'
import home from "../views/admin/page/layout"
import getpwd from "../views/getpwd";
import studenttable from "../views/admin/student/StudentTable"
import studentregister from "../views/Register";
import teachertable from  "../views/admin/teacher/TeacherTable"
import teacherupdate from "../views/admin/teacher/TeacherUpdate"
import coursetable  from "../views/admin/course/CourseTable"
import courseupdate from "../views/admin/course/CourseUpdate"
import studentupdate from '../views/admin/student/StudentUpdate'
import addteacher from "../views/admin/teacher/AddTeacher"
import StudentLayout from "../views/student/frontShow/layout"
import courseview from "../views/student/frontShow/CourseView"
import userlist from "../views/student/frontShow/UserList"
import cartlist from "../views/admin/page/CartList"
import teacherhome from "../views/teacher/layout"
import addcourse from "../views/teacher/page/AddCourse"
import studentinfo from "../views/StudentInfo"
import teacherinfo from "../views/TeacherInfo"
import mangecourse from "../views/teacher/page/MangeCourse"
import authority from  "../views/admin/page/AuthorityControl"
import adminlgoin from "../views/login/adminLgoin";
import salespreview from "../views/teacher/page/SalesPreview"
import manageaccount from "../views/teacher/page/manageAccount"
import studenthome from "../views/student/page/layout"
import myaccount from "../views/student/page/MyAccount"
import mycartlist from "../views/student/page/MyCartList"
import mycourse from "../views/student/page/MyCourse"

Vue.use(Router)


export default new Router({
    mode: 'hash',
    scrollBehavior: () => {
      history.pushState(null, null, document.URL)
    },
  routes:[
    {
      path: '/',
      name: 'Login',
      component: Login
    },
    {
      path: '/adminlogin',
      name: 'adminlogin',
      component: adminlgoin
    },
    {
      path: '/studentinfo',
      name: 'studentinfo',
      component: studentinfo
    },
    {
      path: '/teacherinfo',
      name: 'teeacherinfo',
      component: teacherinfo
    },
    {
      path: '/register',
      name: 'register',
      component: studentregister,
    },
    {
      path: '/getpwd',
      name: 'getpwd',
      component: getpwd
    },
    {
      path: '/home',
      name: 'home',
      component: home,
      meta: {
        title: "后台中心",
        requireAuth: true
      },
      children: [{
          path: '/studenttable',
          name: studenttable,
          component: studenttable,
          meta: {
            title: "学生信息",
            requireAuth: true
          }
        }, {
          path: '/teachertable',
          name: teachertable,
          component: teachertable,
          meta: {
            title: "教师信息",
            requireAuth: true
          }
        }, {
        path: '/coursetable',
        name: coursetable,
        component: coursetable,
        meta: {
          title: "课程信息",
          requireAuth: true
        }
      },{
        path: '/courseupdate',
        name: courseupdate,
        component: courseupdate,
        meta: {
          title: "课程管理",
          requireAuth: true
        }
      },{
        path: '/studentupdate',
        name: studentupdate,
        component: studentupdate,
        meta: {
          title: "学生管理",
          requireAuth: true
        }
      }, {
          path: '/teacherupdate',
          name: teacherupdate,
          component: teacherupdate,
          meta: {
            title: "教师管理",
            requireAuth: true
          }
      }, {
        path: '/addteacher',
        name: addteacher,
        component: addteacher,
      },{
        path: "/cartlist",
        name: cartlist,
        component: cartlist,
        meta: {
          title: "订单管理",
          requireAuth: true
        }
      },{
        path: "/authority",
        name: authority,
        component: authority,
        meta: {
          title: "权限管理",
          requireAuth: true
        }
      }
      ],
    },
    {
      path: '/StudentLayout',
      name: StudentLayout,
      component: StudentLayout,
      children: [{
        path: "/courseview",
        name: courseview,
        component: courseview
      },{
        path: "/userlist",
        name: userlist,
        component: userlist
      }]
    },
    {
      path: "/teacherhome",
      name: teacherhome,
      component: teacherhome,
      meta: {
        title: "教师后台",
        requireAuth: true
      },
      children: [{
        path: "/addcourse",
        name: addcourse,
        component: addcourse,
        meta: {
          title: "添加课程",
          requireAuth: true
        },
      },{
        path: "/mangecourse",
        name: mangecourse,
        component: mangecourse,
        meta: {
          title: "课程管理",
          requireAuth: true
        },
      }, {
        path: "/salespreview",
        name: salespreview,
        component: salespreview,
        meta: {
          title: "销售预览",
          requireAuth: true
        }
      },
        {
          path: "/manageaccount",
          name: mangecourse,
          component: manageaccount,
          meta: {
            title: "账户管理",
            requireAuth: true
          }
        }
      ]
    },
    {
      path: "/studenthome",
      name: studenthome,
      component: studenthome,
      meta: {
        title: "用户中心",
        requireAuth: true
      },
      children: [{
        path: "/myaccount",
        name: myaccount,
        component: myaccount,
        meta: {
          title: "我的信息",
          requireAuth: true
        },
      },{
        path: "/mycartlist",
        name: mycartlist,
        component: mycartlist,
        meta: {
          title: "我的订单",
          requireAuth: true
        }
      }, {
        path: "/mycourse",
        name: mycourse,
        component: mycourse,
        meta: {
          title: "我的课程",
          requireAuth: true
        }
      }
      ]
    }
  ]
});
